<html>
<head><meta charset="utf-8"><title>size_of ParamEnv · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html">size_of ParamEnv</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="202752607"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202752607" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202752607">(Jul 02 2020 at 22:45)</a>:</h4>
<p><code>ParamEnv</code> is 24 bytes, but 8 of those bytes are taken up by a <code>Reveal</code> field really only needs a single bit.</p>



<a name="202752621"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202752621" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202752621">(Jul 02 2020 at 22:45)</a>:</h4>
<p>Any suggestions how to squeeze it into 16 bytes?</p>



<a name="202752684"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202752684" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202752684">(Jul 02 2020 at 22:46)</a>:</h4>
<p>Such a change would likely have good perf effects, because <code>ParamEnv</code> appears within <code>Obligation</code>,  and shrinking that has had good effects in the past</p>



<a name="202752853"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202752853" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202752853">(Jul 02 2020 at 22:49)</a>:</h4>
<p>Apart from encoding it in the list pointer... not really</p>



<a name="202752979"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202752979" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202752979">(Jul 02 2020 at 22:51)</a>:</h4>
<p><span class="user-mention" data-user-id="211727">@Jonas Schievink</span> I think I tried that once, but couldn't get it to work</p>



<a name="202753004"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202753004" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202753004">(Jul 02 2020 at 22:51)</a>:</h4>
<p>Hmm, the <code>def_id</code> mentions chalk, is it only used by the chalk integration?</p>



<a name="202753356"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202753356" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202753356">(Jul 02 2020 at 22:56)</a>:</h4>
<p><span class="user-mention" data-user-id="211727">@Jonas Schievink</span> Seems so. <a href="https://github.com/rust-lang/rust/blob/9672b5e95c520774cc17bffc7031c80a1bcf4b4c/src/librustc_trait_selection/traits/chalk_fulfill.rs#L131-L148">This</a> is the only place it's used</p>



<a name="202753399"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202753399" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202753399">(Jul 02 2020 at 22:57)</a>:</h4>
<p>I guess I could remove that, and see what the perf effects are like</p>



<a name="202754201"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202754201" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202754201">(Jul 02 2020 at 23:08)</a>:</h4>
<p>I found my old patch attempting to encode the bit in the list pointer... in my notes I mentioned problems with <code>?Sized</code></p>



<a name="202755390"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202755390" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202755390">(Jul 02 2020 at 23:30)</a>:</h4>
<p>I was going to suggest making use of the "this is always paired with an empty environment" on Reveal::All, but I think that's actually untrue?</p>



<a name="202755446"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202755446" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202755446">(Jul 02 2020 at 23:31)</a>:</h4>
<p>at least there seem to be cases where it isn't true</p>



<a name="202755516"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202755516" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202755516">(Jul 02 2020 at 23:33)</a>:</h4>
<p><span class="user-mention" data-user-id="120989">@Nicholas Nethercote</span> hm so actually, we should be able to pack it into the option around the defid, even if it is a bit ugly</p>



<a name="202755529"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202755529" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202755529">(Jul 02 2020 at 23:33)</a>:</h4>
<p><span class="user-mention" data-user-id="116122">@simulacrum</span> the <code>reveal</code> field is used quite extensively</p>



<a name="202755530"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202755530" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202755530">(Jul 02 2020 at 23:33)</a>:</h4>
<p>DefId should have at least ~256 niches in it</p>



<a name="202755591"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202755591" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202755591">(Jul 02 2020 at 23:34)</a>:</h4>
<p><span class="user-mention" data-user-id="116122">@simulacrum</span> we need a bool + int, not a <code>Foo | Bar(int)</code></p>



<a name="202755598"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202755598" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202755598">(Jul 02 2020 at 23:34)</a>:</h4>
<p>I think the niches allow the latter, but not the former</p>



<a name="202755610"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202755610" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202755610">(Jul 02 2020 at 23:34)</a>:</h4>
<p>let me try it on playground...</p>



<a name="202755614"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202755614" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202755614">(Jul 02 2020 at 23:34)</a>:</h4>
<p><span aria-label="thumbs up" class="emoji emoji-1f44d" role="img" title="thumbs up">:thumbs_up:</span></p>



<a name="202755683"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202755683" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202755683">(Jul 02 2020 at 23:36)</a>:</h4>
<p>(i.e. the niches allow you to steal up to 256 values from the range of an int, but we need an entire bit, which would halve the range)</p>



<a name="202756018"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202756018" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202756018">(Jul 02 2020 at 23:40)</a>:</h4>
<p>ah perhaps, yes</p>



<a name="202756025"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202756025" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202756025">(Jul 02 2020 at 23:40)</a>:</h4>
<p>current layout I think:</p>
<div class="codehilite"><pre><span></span><code>error: layout_of(ParamEnv) = Layout {
    fields: Arbitrary {
        offsets: [
            Size {
                raw: 0,
            },
            Size {
                raw: 16,
            },
            Size {
                raw: 8,
            },
        ],
        memory_index: [
            0,
            2,
            1,
        ],
    },
    variants: Single {
        index: 0,
    },
    abi: Aggregate {
        sized: true,
    },
    largest_niche: Some(
        Niche {
            offset: Size {
                raw: 12,
            },
            scalar: Scalar {
                value: Int(
                    I32,
                    false,
                ),
                valid_range: 0..=4294967041,
            },
        },
    ),
    align: AbiAndPrefAlign {
        abi: Align {
            pow2: 3,
        },
        pref: Align {
            pow2: 3,
        },
    },
    size: Size {
        raw: 24,
    },
}
</code></pre></div>



<a name="202756039"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202756039" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202756039">(Jul 02 2020 at 23:40)</a>:</h4>
<p><span class="user-mention" data-user-id="120989">@Nicholas Nethercote</span> does this match your expectation?</p>



<a name="202756084"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202756084" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202756084">(Jul 02 2020 at 23:41)</a>:</h4>
<div class="codehilite"><pre><span></span><code>print-type-size type: `rustc_middle::ty::ParamEnv`: 24 bytes, alignment: 8 bytes
print-type-size     field `.caller_bounds`: 8 bytes
print-type-size     field `.def_id`: 8 bytes
print-type-size     field `.reveal`: 1 bytes
print-type-size     end padding: 7 bytes
</code></pre></div>



<a name="202756132"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202756132" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202756132">(Jul 02 2020 at 23:42)</a>:</h4>
<p>hm yes that seems equivalent...</p>



<a name="202756134"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202756134" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202756134">(Jul 02 2020 at 23:42)</a>:</h4>
<p>I think your output says we could squeeze a 32-bit integer in</p>



<a name="202756153"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202756153" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202756153">(Jul 02 2020 at 23:43)</a>:</h4>
<p>which is definitely true :)</p>



<a name="202756161"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202756161" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202756161">(Jul 02 2020 at 23:43)</a>:</h4>
<p>(I find that new layout style info very hard to read)</p>



<a name="202756169"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202756169" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202756169">(Jul 02 2020 at 23:43)</a>:</h4>
<p>how do you get print-type-size to work? Do I need to use the type somewhere?</p>



<a name="202756171"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202756171" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202756171">(Jul 02 2020 at 23:43)</a>:</h4>
<p>(doesn't even name the fields)</p>



<a name="202756222"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202756222" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202756222">(Jul 02 2020 at 23:43)</a>:</h4>
<p><a href="https://blog.mozilla.org/nnethercote/2018/11/09/how-to-get-the-size-of-rust-types-with-zprint-type-sizes/">https://blog.mozilla.org/nnethercote/2018/11/09/how-to-get-the-size-of-rust-types-with-zprint-type-sizes/</a> :)</p>



<a name="202756305"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202756305" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202756305">(Jul 02 2020 at 23:44)</a>:</h4>
<p>hm maybe I'm doing something wrong</p>



<a name="202756312"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202756312" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202756312">(Jul 02 2020 at 23:44)</a>:</h4>
<p>it doesn't seem to give me anything about ParamEnv</p>



<a name="202756417"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202756417" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202756417">(Jul 02 2020 at 23:46)</a>:</h4>
<p><a href="https://gist.github.com/Mark-Simulacrum/fc7f19d8e89a9b4fa1369a51b740be41">https://gist.github.com/Mark-Simulacrum/fc7f19d8e89a9b4fa1369a51b740be41</a></p>



<a name="202756498"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202756498" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202756498">(Jul 02 2020 at 23:48)</a>:</h4>
<p>but yeah my output indicates a niche in bytes 12-16 I think</p>



<a name="202756513"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202756513" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202756513">(Jul 02 2020 at 23:48)</a>:</h4>
<p><span class="user-mention" data-user-id="116122">@simulacrum</span> follow the instructions in the blog post more carefully :)</p>



<a name="202756528"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202756528" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202756528">(Jul 02 2020 at 23:49)</a>:</h4>
<p>you need <code>rustc_private</code> in your code, and <code>RUSTC_BOOTSTRAP=1</code> in your invocation</p>



<a name="202756578"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202756578" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202756578">(Jul 02 2020 at 23:50)</a>:</h4>
<p>I see a 1.5% instruction count win on <code>serde</code> after removing the only-used-by-chalk <code>ParamEnv::def_id</code> field</p>



<a name="202756580"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202756580" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202756580">(Jul 02 2020 at 23:50)</a>:</h4>
<p>er that seems wrong? Like my code is compiling</p>



<a name="202756589"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202756589" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202756589">(Jul 02 2020 at 23:50)</a>:</h4>
<p>I am using nightly...</p>



<a name="202756595"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202756595" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202756595">(Jul 02 2020 at 23:50)</a>:</h4>
<p>does it like, not print the current crate? that would be odd</p>



<a name="202756599"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202756599" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202756599">(Jul 02 2020 at 23:50)</a>:</h4>
<p>Here's my program:</p>



<a name="202756602"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202756602" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202756602">(Jul 02 2020 at 23:51)</a>:</h4>
<div class="codehilite"><pre><span></span><code>extern crate rustc_middle;
extern crate rustc_infer;
fn main() {
    let _x = std::mem::size_of::&lt;rustc_middle::traits::ObligationCauseData&gt;();
    let _x = std::mem::size_of::&lt;rustc_infer::traits::PredicateObligation&lt;&#39;_&gt;&gt;();
}
</code></pre></div>



<a name="202756667"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202756667" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202756667">(Jul 02 2020 at 23:52)</a>:</h4>
<p>does it not work with nightlies?</p>



<a name="202756670"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202756670" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202756670">(Jul 02 2020 at 23:52)</a>:</h4>
<p>oh, that might not work with nightly, ObligationCauseData might be too new</p>



<a name="202756675"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202756675" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202756675">(Jul 02 2020 at 23:52)</a>:</h4>
<p>no I mean I can't get type-sizes to work at all for locally-defined types</p>



<a name="202756677"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202756677" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202756677">(Jul 02 2020 at 23:52)</a>:</h4>
<p>e.g. your program still gives me the same output</p>



<a name="202756686"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202756686" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202756686">(Jul 02 2020 at 23:53)</a>:</h4>
<p>this works</p>



<a name="202756689"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202756689" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202756689">(Jul 02 2020 at 23:53)</a>:</h4>
<div class="codehilite"><pre><span></span><code>\#![feature(rustc_private)]
extern crate rustc_middle;
fn main() {
    let _x = std::mem::size_of::&lt;rustc_middle::ty::ParamEnv&gt;();
}
</code></pre></div>



<a name="202756695"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202756695" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202756695">(Jul 02 2020 at 23:53)</a>:</h4>
<p>compiled with <code>RUSTC_BOOTSTRAP=1 rustc +nightly -Zprint-type-sizes b.rs</code></p>



<a name="202756700"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202756700" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202756700">(Jul 02 2020 at 23:53)</a>:</h4>
<p>yeah that does</p>



<a name="202756740"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202756740" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202756740">(Jul 02 2020 at 23:54)</a>:</h4>
<p>you almost certainly don't need bootstrap, btw</p>



<a name="202756755"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202756755" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202756755">(Jul 02 2020 at 23:54)</a>:</h4>
<p>oh huh</p>



<a name="202756756"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202756756" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202756756">(Jul 02 2020 at 23:54)</a>:</h4>
<p>maybe I was just blind</p>



<a name="202756762"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202756762" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202756762">(Jul 02 2020 at 23:54)</a>:</h4>
<p>anyway okay so I seem to be matching</p>



<a name="202756764"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202756764" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202756764">(Jul 02 2020 at 23:54)</a>:</h4>
<p>true, the bootsttap isn't necessary</p>



<a name="202756779"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202756779" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202756779">(Jul 02 2020 at 23:55)</a>:</h4>
<p>in conclusion, stealing a bit from the Option&lt;DefId&gt; isn't possible</p>



<a name="202756782"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202756782" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202756782">(Jul 02 2020 at 23:55)</a>:</h4>
<p>stealing a bit from the pointer should be possible, but I couldn't get it to work last time I tried</p>



<a name="202756832"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202756832" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202756832">(Jul 02 2020 at 23:56)</a>:</h4>
<p>hm so cratenum today allows for a full 2^64 crates</p>



<a name="202756843"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202756843" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202756843">(Jul 02 2020 at 23:56)</a>:</h4>
<p>or I guess 2^32</p>



<a name="202757488"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202757488" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202757488">(Jul 03 2020 at 00:05)</a>:</h4>
<p>minus one for <code>ReservedForIncrCompCache</code>, yes</p>



<a name="202757530"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202757530" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202757530">(Jul 03 2020 at 00:05)</a>:</h4>
<p>well, we actually take out a full 256 from any rustc_index declared type</p>



<a name="202757533"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202757533" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202757533">(Jul 03 2020 at 00:05)</a>:</h4>
<p>but regardless that doesn't really help us</p>



<a name="202758461"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202758461" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202758461">(Jul 03 2020 at 00:21)</a>:</h4>
<p>I think it's true that List pointers always have the bottom bit empty -- they must be aligned same as a usize at least</p>



<a name="202758550"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202758550" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202758550">(Jul 03 2020 at 00:23)</a>:</h4>
<p>it'll be a pain to remove reveal because it's <code>pub</code> I guess</p>



<a name="202758900"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202758900" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202758900">(Jul 03 2020 at 00:29)</a>:</h4>
<p>ah okay, so I think I see why rustc can't make this optimization today (or at least one reason): niches are always represented as ranges of values rather than masks</p>



<a name="202758907"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202758907" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202758907">(Jul 03 2020 at 00:29)</a>:</h4>
<p>so alignment doesn't help rustc at all I think</p>



<a name="202760348"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202760348" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202760348">(Jul 03 2020 at 01:04)</a>:</h4>
<p><span class="user-mention" data-user-id="120989">@Nicholas Nethercote</span> well filed <a href="https://github.com/rust-lang/rust/pull/73978">https://github.com/rust-lang/rust/pull/73978</a></p>



<a name="202760428"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202760428" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202760428">(Jul 03 2020 at 01:06)</a>:</h4>
<p><span class="user-mention" data-user-id="116122">@simulacrum</span> nice! I will review if/when the perf results look good</p>



<a name="202760447"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202760447" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202760447">(Jul 03 2020 at 01:07)</a>:</h4>
<p>yep, review was mostly tentative anyway (though I believe it's in a reasonable to land state, i.e., no big hacks)</p>



<a name="202760452"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202760452" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202760452">(Jul 03 2020 at 01:07)</a>:</h4>
<p>though definitely some opportunities for polish</p>



<a name="202760501"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202760501" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202760501">(Jul 03 2020 at 01:08)</a>:</h4>
<p>and an assert as to the bit I'm using being available seems reasonable too, though I think the only way it wouldn't be is if usize is 8-bits and that's just not happening</p>



<a name="202773679"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202773679" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202773679">(Jul 03 2020 at 06:59)</a>:</h4>
<p>How hard <em>would</em> it be to teach rustc to use aligned pointers for niches?</p>



<a name="202773749"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202773749" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202773749">(Jul 03 2020 at 07:00)</a>:</h4>
<p>Because I suspect there are <em>many</em> structures that would benefit from that.</p>



<a name="202773790"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202773790" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202773790">(Jul 03 2020 at 07:01)</a>:</h4>
<p>Enums containing a reference in each branch, for instance.</p>



<a name="202777854"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202777854" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202777854">(Jul 03 2020 at 08:07)</a>:</h4>
<p>That is not possible. It must always be possible to take a reference to a field. If you were to use the bits fixed by alignment as discriminant for two variants containing a reference, then one of the variants would get a misaligned reference, which means that it is not safe to take a reference to that variant field.</p>



<a name="202779157"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202779157" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202779157">(Jul 03 2020 at 08:25)</a>:</h4>
<p><span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span> I also previously looked at shrinking <code>ParamEnv</code> after working on <a href="https://github.com/rust-lang/rust/pull/72962">https://github.com/rust-lang/rust/pull/72962</a> gj <span aria-label="thumbs up" class="emoji emoji-1f44d" role="img" title="thumbs up">:thumbs_up:</span> </p>
<p>If we were to only allow 2^31 - 1 different <code>CrateId</code>s we should have 1 bit per <code>DefId</code> to encode something, which might be better for<br>
<code>ParamEnv</code> (as the caller bounds seem to be more frequently used than the <code>DefId</code>) and might help in a few other places as well</p>
<p>i.e. we can have tagged union of <code>DefId + &amp;'tcx AtLeastAlign2</code> which only takes 8 bytes.</p>



<a name="202779409"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202779409" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202779409">(Jul 03 2020 at 08:28)</a>:</h4>
<p>the rust compiler truly is a place of micro optimizations <span aria-label="rolling on the floor laughing" class="emoji emoji-1f923" role="img" title="rolling on the floor laughing">:rolling_on_the_floor_laughing:</span></p>



<a name="202795017"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202795017" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202795017">(Jul 03 2020 at 11:47)</a>:</h4>
<p><span class="user-mention" data-user-id="216206">@lcnr</span> yeah, maybe. it's harder to do things with DefId and packing -- pointers are easier to cast in/out.</p>



<a name="202822736"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202822736" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202822736">(Jul 03 2020 at 17:02)</a>:</h4>
<p>cc <span class="user-mention" data-user-id="116009">@nikomatsakis</span> (I'm curious what are the long-term plans for <code>ParamEnv</code>, wrt Chalk and whatnot)</p>



<a name="202822768"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202822768" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202822768">(Jul 03 2020 at 17:03)</a>:</h4>
<p>I think I had some plans to tweak the <code>Reveal</code> field to fit the "intercrate" (coherence-checking) mode into it</p>



<a name="202822780"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202822780" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202822780">(Jul 03 2020 at 17:03)</a>:</h4>
<p>to improve global caching in the trait system</p>



<a name="202822794"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202822794" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202822794">(Jul 03 2020 at 17:03)</a>:</h4>
<p>it should only be used with <code>Reveal::UserFacing</code> so it goes 2-&gt;3 values (as opposed to adding another full bit)</p>



<a name="202822849"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202822849" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202822849">(Jul 03 2020 at 17:04)</a>:</h4>
<p>although at that point the name starts to make even less sense</p>



<a name="202822869"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202822869" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202822869">(Jul 03 2020 at 17:04)</a>:</h4>
<p>it's more like a "perspective" :P</p>



<a name="202831262"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202831262" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202831262">(Jul 03 2020 at 19:25)</a>:</h4>
<p>we have 2 bits I think of space for usize (on 32-bit) I believe, so that should be fine</p>



<a name="202884063"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202884063" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202884063">(Jul 04 2020 at 17:43)</a>:</h4>
<p>we should start using const generics to do "pack some data in the lowest N bits of the pointer"</p>



<a name="202884073"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202884073" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202884073">(Jul 04 2020 at 17:43)</a>:</h4>
<p>we do that for <code>ty::GenericArg</code> already :P</p>



<a name="202942082"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202942082" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202942082">(Jul 05 2020 at 23:03)</a>:</h4>
<p><span class="user-mention" data-user-id="216206">@lcnr</span> The <code>DefId</code> is only used for Chalk integration, i.e. not by default. What is Chalk, anyway?</p>



<a name="202942090"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202942090" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202942090">(Jul 05 2020 at 23:03)</a>:</h4>
<p>/me finds <a href="https://github.com/rust-lang/chalk">https://github.com/rust-lang/chalk</a></p>



<a name="202943496"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/202943496" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#202943496">(Jul 05 2020 at 23:50)</a>:</h4>
<blockquote>
<p>What is Chalk, anyway</p>
</blockquote>
<p>Oh, my heart <span aria-label="pensive" class="emoji emoji-1f614" role="img" title="pensive">:pensive:</span></p>



<a name="203043264"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/203043264" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#203043264">(Jul 06 2020 at 21:32)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> in chalk <code>Reveal</code> is basically something in the environment</p>



<a name="203043292"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/203043292" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#203043292">(Jul 06 2020 at 21:32)</a>:</h4>
<p>this is probably what I would want for rustc too</p>



<a name="203043322"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/203043322" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#203043322">(Jul 06 2020 at 21:33)</a>:</h4>
<p>so we would basically eliminate the field and instead if you wanted to test for reveal you could check whether the environment predicates include <code>Predicate::Reveal</code></p>



<a name="203043335"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/203043335" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#203043335">(Jul 06 2020 at 21:33)</a>:</h4>
<p>we can discuss how to make that efficient, I suppose</p>



<a name="203043344"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/203043344" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#203043344">(Jul 06 2020 at 21:33)</a>:</h4>
<p>heh</p>



<a name="203043367"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/203043367" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#203043367">(Jul 06 2020 at 21:33)</a>:</h4>
<p>but it's (I think) the right way to think about it</p>



<a name="203043369"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/203043369" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#203043369">(Jul 06 2020 at 21:33)</a>:</h4>
<p>nice axiom</p>



<a name="203043456"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/203043456" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#203043456">(Jul 06 2020 at 21:34)</a>:</h4>
<p>(it's not obvious to me that it's important performance wise anyway, we'd have to measure)</p>



<a name="203043474"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/203043474" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#203043474">(Jul 06 2020 at 21:34)</a>:</h4>
<p>this is the kind of thing I hear nullary typeclasses are used for (I guess it'd be something like <code>(): Reveal</code> in Rust)</p>



<a name="203043491"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/203043491" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#203043491">(Jul 06 2020 at 21:35)</a>:</h4>
<p>and so you end up with something like a hypothesis</p>



<a name="203043507"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/203043507" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#203043507">(Jul 06 2020 at 21:35)</a>:</h4>
<p>Sure. In Chalk it's just a kind of <a href="http://rust-lang.github.io/chalk/chalk_ir/enum.DomainGoal.html"><code>DomainGoal</code></a></p>



<a name="203043514"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/203043514" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#203043514">(Jul 06 2020 at 21:35)</a>:</h4>
<p>(which would be an axiom if it held at the top-level)</p>



<a name="203043583"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/203043583" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#203043583">(Jul 06 2020 at 21:36)</a>:</h4>
<p><a href="http://rust-lang.github.io/chalk/chalk_ir/enum.DomainGoal.html#variant.Reveal"><code>DomainGoal::Reveal</code></a></p>



<a name="203043619"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/203043619" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#203043619">(Jul 06 2020 at 21:36)</a>:</h4>
<p>we don't need that <code>()</code> in there anymore actually, that was an artifact of older macro-rules-style things...</p>



<a name="203043625"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/203043625" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#203043625">(Jul 06 2020 at 21:36)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> ever considered having a "constructive" approach where you explicitly referred to "witnesses"?</p>



<a name="203043636"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/203043636" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#203043636">(Jul 06 2020 at 21:36)</a>:</h4>
<p>I'm not sure what that means in this context :)</p>



<a name="203043659"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/203043659" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#203043659">(Jul 06 2020 at 21:36)</a>:</h4>
<p>don't talk fancy at me</p>



<a name="203043660"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/203043660" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#203043660">(Jul 06 2020 at 21:36)</a>:</h4>
<p>:P</p>



<a name="203043695"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/203043695" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#203043695">(Jul 06 2020 at 21:37)</a>:</h4>
<p>like <code>a: (T: Trait)</code> where <code>a</code> is the witness that <code>T</code> implements <code>Trait</code> and you plumb it through anything that requires it</p>



<a name="203043708"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/203043708" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#203043708">(Jul 06 2020 at 21:37)</a>:</h4>
<p>basically like dictionary passing I guess</p>



<a name="203043760"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/203043760" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#203043760">(Jul 06 2020 at 21:37)</a>:</h4>
<p>Ah, I see. That's certainly not the approach that chalk takes -- I've kind of tried to steer <em>away</em> from that, i.e., making it unnecessary to know "how" you proved something, only that you proved it</p>



<a name="203043804"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/203043804" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#203043804">(Jul 06 2020 at 21:38)</a>:</h4>
<p>it'd all be kind of abstract except for referring to concrete <code>impl</code>s etc.</p>



<a name="203043842"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/203043842" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#203043842">(Jul 06 2020 at 21:38)</a>:</h4>
<p>but I could be persuaded to change if we felt it'd be useful for something, I suppose.</p>



<a name="203043881"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/203043881" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#203043881">(Jul 06 2020 at 21:38)</a>:</h4>
<p>makes sense, it's mostly just me realizing how close it is to a proof system and had a constructivist kneejerk</p>



<a name="203043965"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/203043965" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#203043965">(Jul 06 2020 at 21:39)</a>:</h4>
<p>anyway, circling back around, moving the <code>Reveal</code> from a flag in the <code>ParamEnv</code>, into the list of predicates, is pretty much what was discussed here</p>



<a name="203044030"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/203044030" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#203044030">(Jul 06 2020 at 21:40)</a>:</h4>
<p>except without a <code>Predicate::Reveal</code> or w/e inside rustc, pointer tagging came up instead</p>



<a name="203044069"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/203044069" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#203044069">(Jul 06 2020 at 21:40)</a>:</h4>
<p>not sure what effect putting it into the list as a <code>Predicate</code> would have on performance</p>



<a name="203044084"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/203044084" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#203044084">(Jul 06 2020 at 21:40)</a>:</h4>
<p>well even if we did have it in the predicate list then I'd still probably suggest caching it in a pointer tag (basically like typeflags does), though we'd probably want to benchmark</p>



<a name="203044121"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/203044121" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#203044121">(Jul 06 2020 at 21:41)</a>:</h4>
<p>it'd be a mildly annoying change to make with the current ty::List due to a lack of subslicing, I imagine</p>



<a name="203044154"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/203044154" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#203044154">(Jul 06 2020 at 21:41)</a>:</h4>
<p>yeah we'd want to not toggle it wildly and make sure we construct the <code>ParamEnv</code> we want from the start</p>



<a name="203044236"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/size_of%20ParamEnv/near/203044236" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/size_of.20ParamEnv.html#203044236">(Jul 06 2020 at 21:42)</a>:</h4>
<p>no <code>tcx.param_env(def_id).with_reveal_all()</code>, it'd be <code>tcx.param_env_reveal_all(def_id)</code> etc.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>